﻿@using Orchard.ContentManagement

@{
    Script.Require("AssociativyFrontends_AutoComplete").AtFoot();
    Style.Require("jQueryUI_Orchard");
}

@using (Script.Foot())
{
    <script type="text/javascript">
        (function ($) {
            $(function () {
                var $graphName = $("#GraphName");

                var selected = $graphName.find(":selected");
                if (selected.length > 0) {
                    $.associativy.autoComplete.labels("#associativy-search-filter-labels", "@Url.Action("FetchSimilarLabels", "AutoComplete", new { Area = "Associativy.Frontends" })?graphName=" + selected.val());
                }

                $graphName.click(function () {
                    $.associativy.autoComplete.labels("#associativy-search-filter-labels", "@Url.Action("FetchSimilarLabels", "AutoComplete", new { Area = "Associativy.Frontends" })?graphName=" + $(this).find(':selected').val());
                });
            });
        })(jQuery);
    </script>
}

@Display.TokenHint()